`
https://leetcode.cn/problems/maximum-number-of-vowels-in-a-substring-of-given-length/
`

/**
 * @param {string} s
 * @param {number} k
 * @return {number}
 */
var maxVowels = function (s, k) {
  const n = s.length
  let curCount = 0
  let maxCount = 0
  let left = 0, right = 0
  const all = 'aeiou'

  // 维护一个长度为 k 的滑动窗口即可
  while (right < n) {
    const c = s[right++]
    if (all.includes(c)) {
      curCount++
    }
    maxCount = Math.max(maxCount, curCount)

    if (right - left >= k) {
      const d = s[left++]
      if (all.includes(d)) {
        curCount--
      }
    }
  }

  return maxCount
};